package com.macro.mall.bo;

import com.macro.mall.model.UmsAdmin;
import com.macro.mall.model.UmsResource;
import com.macro.mall.security.component.BaseUserDetails;
import lombok.Getter;
import lombok.Setter;

import java.util.List;
import java.util.Set;

/**
 * SpringSecurity需要的用户信息封装类
 * Created by macro on 2018/4/26.
 */
@Setter
@Getter
public class AdminUserDetails extends BaseUserDetails {
    //后台用户
    private UmsAdmin umsAdmin;
    //拥有资源列表
    private List<UmsResource> resourceList;

    public AdminUserDetails(UmsAdmin umsAdmin, Set<String> resourceList) {
        super(umsAdmin.getId(), umsAdmin.getNickName(), umsAdmin.getUsername(), umsAdmin.getPassword(),
                umsAdmin.getStatus() == 1, true, true, true, resourceList);
    }

}
